/***************************************************************************
 *   Copyright (C) 2007 by Gaetano Mendola  *
 *   mendola@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream>

#include "weapon.h"
#include "timer.h"
#include "shaman.h"
#include "talents/flurry.h"
#include "target.h"
#include "combatlog.h"

using namespace std;

#define DPS 100.0

int main(int argc, char *argv[])
{
    if (argc < 2) {
        std::cout << "You need to specify the crit percentage" << std::endl;
        ::exit(0);
    }

    double myCritPercentage = ::atoi(argv[1])/10.0;

    Talents::Talent * myTalent = new Talents::Flurry(5);
    Shaman::instance().setCritPercentage(myCritPercentage);
    Shaman::instance().addTalent(myTalent);

#if 1
    Weapon * myWeaponMain = new Weapon("MainHand", 2.6, DPS);
    Shaman::instance().equipInMainHand(myWeaponMain);

    Weapon * myWeaponOff = new Weapon("OffHand", 1.5, DPS);
    Shaman::instance().equipInOffHand(myWeaponOff);

    Target myTarget;
    CombatLog myCombatLog;

    Timer::instance().go(100);
#endif 
#if 0 
    double speed;
    for ( speed = 0.1; speed <= 5.0; speed += 0.1) {
        Timer::instance().reset();
        Weapon * myWeapon = new Weapon("TestWeapon", speed, DPS);
        Shaman::instance().equipInMainHand(myWeapon);

        Target myTarget;
        Timer::instance().go(10000000);
        std::cout << "SPEED: " << speed << " ";
    }
#endif
#if 0
    double speedMain, speedOff;
    for ( speedMain = 0.1; speedMain <= 5.0; speedMain += 0.1) {
        for ( speedOff = 0.1; speedOff <= 5.0; speedOff += 0.1) {
            Timer::instance().reset();
            Weapon * myWeaponMain = new Weapon("MainHand", speedMain, DPS);
            Shaman::instance().equipInMainHand(myWeaponMain);

            Weapon * myWeaponOff = new Weapon("OffHand", speedOff, DPS/2.0);
            Shaman::instance().equipInOffHand(myWeaponOff);

            Target myTarget;
            Timer::instance().go(100000);
            std::cout << "MAINS: " << speedMain << " OFFS: " << speedOff << " ";
        }
        std::cout << std::endl;
    }
#endif

    return EXIT_SUCCESS;
}
